Okay, so welcome to the first project in this course.
Now in this project we are going to be having a look how to make our first OBE.
Okay.
Now an Obi is just a game with a bunch of obstacles.
It's like an obstacle course game.
So we can create here.
So it's up to you how you want to use these lessons.
You can follow along if you'd like to.
You can have a go at creating it yourself and then watching some of the videos if you get stuck.
Or you can watch these videos inspiration and try it out yourself, it's completely up to you how you
use these.
Okay, these lessons will be a bit longer than some of the other ones, as we'll be doing a lot more
building and actually applying what we already know in these lessons.
So you will learn some new things, but majority of it will just be an application of what we already
know.
Okay, so I have opened up a standard plate and we're going to work off of that.
I know roadblocks, they do have a Obi template.
However I'd like to start from scratch here.
Okay.
So I've opened up this here.
I'm going to go into the workspace and just delete the base plate and the spawn location.
We're going to add all that in in a minute.
Okay.
So um don't feel like you have to do exactly what I'm doing.
Okay.
But for my Obi I would like it to have five stages, and the majority of those stages are going to be
involve some kind of coding as well.
Okay.
So I'm going to add some folders into the workspace for some organization to start off with.
Okay.
As it's very a good idea for us to keep organized.
So I'm going to add in five.
So one for stage one.
Stage two.
Stage three.
Stage four.
It's going to do a bit of a weird order, but that's fine.
And then stage five.
Okay, I'm also going to add one in for the spawn and for the finish area.
So spawn and finish because once we're finished with our obby, they often have a winner's section where
you can do all kind of cool things.
Um, which is where we're going to have some stuff in there.
I'm also going to create another folder called other, in case there's any other kind of stuff that
we want to use with put inside of there.
Okay.
So let's have a go then at starting to create our first stage okay.
So I'm going to add in a part into the spawn area okay.
Um part here okay.
And this will be the main kind of platform for the spawn area.
Okay.
Um so we can kind of model this around okay.
So let's make sure this is anchored start off with.
Otherwise it's going to fall down.
And let's just do some um let's do some laying out and things like that.
So I'm going to set the size of this maybe say 15 by 15 perhaps see what that's like.
Um, whenever you do this, we can always click play here and just see how much space is taking up.
Is it too big?
Is it too small?
I think this bit it's too small for the spawn.
I'd like it to be a bit bigger.
Um.
Maybe, let's say 25 or I think maybe even 30, I think.
Nice and big.
So it can hold a couple of players here when players are joining the game.
It's a bit better.
I think I like this here, so I think we'll leave it like that, which is quite cool.
Okay, um, let's add in a spawn location.
Obviously.
So we spawn location here.
Um, when a player first joins the game, they will spawn at this spawn location here.
Now there will be other spawn locations for other stages as, um, if the player dies on stage three,
for example, you wouldn't want them to spawn right back at the start.
So um, we will have a look at that later on, but for now we're just going to set one down here.
The move I've got to be 0.1.
I'm going to change that to one stud.
So I'm I'm moving in smaller increments and position it.
So it's nicely in the center there and make sure it is in the center based on the position.
Um, I'm going to change the position around a little bit.
I'm going to set this to be 000 just so it's nicer to work with, and then set the position here as
well to 000.
It just makes it easier when you are coding this okay.
The spawn location itself.
Is fine as it is there.
I am going to set transparency to one.
Now this is only the transparency of the part itself and not the little decal at the top.
I'd like to keep that.
I think it looks it shows that it's actually a spawn location that we're working with.
Okay.
Um, as for the details on this, I'm going to change around how this part here looks.
I want to give it a cool material.
Um, how does like a stone one kind of look?
Um.
Let's see.
Cobblestone.
Looks okay.
Um.
What other ones have we got?
Stone somewhere.
And looking for it.
Rock.
Yeah I think we're going to stick with cobblestone I think personally.
But again, it's completely up to you what you choose.
Okay.
And we'll leave it like that for now.
So just a basic kind of start area that I think is quite nice.
Okay.
So that's our spawn location and obviously we can do more with that as we go along.
So let's start by constructing our first stage.
So I'm going to go into stage one.
And instead of adding a new part in I'm just going to duplicate this current part and drag it into stage
one because it has the correct dimensions, it has the correct position.
So I know that it's all okay.
I'll do some adjustments, of course, but I know that it's okay for now and I'm going to design this
one.
I'm not going to code this one.
Okay.
Um, but I'm going to design it so that it becomes increasingly more difficult as you go up based on
the transparency of the parts.
This one's going to use the parts transparencies.
So let's make these much smaller.
I'm thinking five by five personally.
Again we can always try these out.
I'm going to give these a different um maybe like a smooth plastic I think.
And a slightly different color.
A gray color might look nice.
Something like that.
Okay.
Um, how I think about this one working is it starts off like this, then it goes into like two directions
and it kind of goes upwards a bit.
So I'm going to duplicate this one.
Mean a lot of this will kind of show you as well.
When you are building, you duplicate a lot of things instead of adding in parts every single time.
It just saves you a lot of time, really.
So duplicate it, move it outwards there, and let's duplicate this one as well.
There okay.
One's going to go to the left.
The other one's going to go to the right.
So let's count
123456789
ten.
Let's try that.
And it's also just move this 110 upwards here as well.
Like that.
They're okay.
Always make sure to try these out.
Okay, so let's play the game and just see what we think of that.
Um, how difficult is it for the player to jump and so on.
So let's jump over here.
That's fine.
That's fine as well.
Okay.
That works great.
So let's I want these to kind of go up a bit.
So what I can do is I can select both of these, duplicate both of them and move them around like this
here.
So it's all about just saving a bit of time.
Let's change the move lock a bit.
And I want these to be up a bit higher.
So the player is kind of climbing up a bit okay.
We need to be careful here because when the player is jumping, if they're jumping upwards they're going
to be they're going to be able to not be able to travel as far.
Um, so I'm going to try and do that and see see what that's like.
I mean, this is going to be a lot of just testing around and seeing what we think.
Um, so let's go up here, up here, up here I like that we're going to keep the same jump interval
I think, for this one.
So we could count and do it that way.
Or what we could do is duplicate these four and move it into the place so that the bottom two in the
same place as the front two, if you know what I mean.
Like that.
And we can just go ahead and delete those two as well.
Okay.
Cool.
Um, I mentioned that I want these to become more difficult based on my transparency.
So the first two here, I want to set the transparency to be 0.3.
Like that's fair.
Okay.
Set the next two to be 0.6 and the last 2 to 0.9.
I don't want to set them to one.
Otherwise they'll be completely invisible and the player won't know where to jump unless you tell them.
So I think it works quite well because as you're going up, it becomes more difficult to deceive apart.
Okay.
And once they've done, I want it to jump.
I want them to jump down onto another platform and then arrive at the second stage.
Okay.
Um, so for this, I'm going to copy this part actually, because it's on the same level and I'm going
to I'm actually going to use a wedge for this.
So let's change the shape property to wedge.
I think using a wedge is better in this case because the player can almost like I feel like if a player
jumps on it, they might fall off a little bit.
So it becomes it makes it more exciting, I think.
And let's change the move to grid to five.
Like this here.
Nice.
And let's move it over as well.
So hopefully all this is showing you how the skills you've learnt are kind of applied and how.
Yeah, how to properly apply the skills that you know.
Um, now I want to, for the next spawn to sit on the same level as the first one.
So, um, I can move this down a little bit, but not up, so I can scale it downwards here, but not
upwards.
I think that looks quite nice.
So, um, let's copy the, um, these two bits here from the spawn location.
Um, drag this into stage one, move it across and see how I like it.
So I think that's a good jump for the player to make.
It's all about trial and error with this, because you don't want a jump to be too far and the player
won't be able to do it.
So you need to make sure the player is able to make these jumps.
And let's let's jump here.
I'm here.
My skills here are going to be tested.
Not just about.
And then.
Oh okay.
Obviously that one's too far at the end, but that's fine.
We know that.
Now you can select both of these and the spawn location and engine.
Move those a bit further then.
Not too much.
Only a little bit is required.
I think that'd be fine there.
I'm just going to double check by spawning playing the game here.
The play here game feature is really good for this one, and you're trying to make that jump again.
Yeah, perfect.
Because you want a good amount so that it's not too easy for the player.
But it's also not too difficult.
I also think making these spawn locations a little bit smaller for the individual stages, as players
aren't really going to be hanging around there as long as they might be doing on the spawn bit.
Now I could change the size this way here, but notice how it then makes that jump larger.
So I want to keep the distance here.
So instead I'm going to use the scale tool okay I'm going to move by five.
And I want this to be maybe about 15 I think.
Let's see how.
This looks like 20 I think.
Looks quite nice.
I think I'm going to keep with 20 to be honest.
And let's keep spawn location in the middle there as well.
Perfect.
So hopefully you can see as well.
I'm changing the snap to grid quite a lot of times based on what's going on.
Okay, so it's a good idea to change that based on based on your needs for it.
I'm going to rename some of these parts.
So this I'm going to call the base plate oh caps Lock on.
And I'm going to call this bit here the base plate.
Now remember I am using folders for this and not models because otherwise I wouldn't be able to individually
select ones and it would be selecting all of it at once.
So models really are the way to go for these ones.
Okay.
Um, and there we go.
So I'm going to add a couple other things to do with this.
Um, for the first stage I want to add 1 or 2 things in, um, the first thing I want to add a little
display telling you that this is stage one.
And we're going to add some objects in as well, but they'll be more used with to do with scripting.
So I'll add them in, but we'll be coding them later on okay.
So let's duplicate this part here.
And I'm going to I'm going to call this stage part.
Okay.
Um, no spaces with that one.
And I am going to, um, move this forward a bit so that it's just on the edge here.
Let's change the move to one and scale.
This is going to be very thin.
This object we can see here that it's, um, it's I want it to be just touching and it's jumping over
it.
In that case, we need to change the move to be 0.5 and move it like that there.
Then change it back up to one.
Because remember, you don't want it too low okay.
If you do, if you do need to move a snap to grid option lower, move it, do whatever you want to do,
then change it back okay.
And I'm going to move it up here.
So I'm going to put here a guy which just shows you, um, what stage we're on.
Okay.
Now we've looked at guys in starter UI.
They can also exist on objects okay.
So this object here I can add in a surface guy which will display guys on its surface, which is pretty
cool.
Okay.
Now these work just like any other screen guy.
Okay.
So we can add a frame or anything like that.
We're wanting to tell them that this is stage one.
So I'm going to add in a text label in this case okay.
And because this works on all faces we need to check which face it's on.
It's on this face here.
And obviously we want it to be displaying on this face at the front.
So it's currently on the front.
So if we line it up this is the front here.
So it's going to be on the right hand side if I'm correct.
Perfect.
Okay.
We can see our label here.
So we will need to go on to this text label.
Change the size to be one comma zero comma one comma zero, which means one on the x and y offset.
Okay.
And we can see it here.
Now I want this just to display the text and nothing else.
So I'm going to set the transparency of this to be one.
And also make sure can collide is off.
Otherwise the player is going to be stopped by it which isn't going to be any good.
And um, text label here, the background transparency to be one as well.
Cool.
Um, go down to the text ones.
This is going to be called.
I'm going to just call this stage one.
Mm.
There we go.
Obviously you want to make it much larger as well.
So turning text scaled on is probably the best idea.
You can see here.
And I think the source sans default font is quite ugly.
And you can see here you've got all the font, different fonts you can change.
I'm going to give it the Freedom One font.
I think it looks quite nice.
Style font Obie.
But of course you can use whichever ones you'd like.
And there you go.
So this is it is our stage part, which we'll do at the start of each one.
Just telling the player what stage they're up to.
Okay.
Um, I'm going to add in two other parts.
Okay.
Um, these parts are going to be called start and end.
Okay.
I'm actually going to copy this one.
Call it start.
Delete the service givo, and we need to scale it so that when the player starts with stage, they will
they will have to collide with this object.
Okay.
So make sure they can't jump over it or anything like that at all.
Okay.
And very important explain why in a little bit.
Um, it's probably a bit overkill, but that'll be fine there.
Okay, that's our start part.
And duplicate this and we're going to create another one for end there.
Okay.
Let's move it across just before they get on to the next one here.
So what other points.
What's the point of this start and end parts.
Well we're going to code them later on.
But basically when the player is going through this stage I want to time them.
Okay.
So we know how long it took them to complete each stage.
Now in order to time them you need to know when they start.
Start the game.
Sorry, not start the game.
Start the stage and end the stage.
Okay, now you could do this by detecting when they stop, they go on the first object, or maybe when
they go on the last object, but they're not really finished here.
There's got one more jump to do.
So that's why I decided to use the two big parts for that one.
Okay, one here and one here, because they have to go through this part in order to start off with,
and they have to go with this through this part here to end.
Okay.
We will do more of the scripting for the game later on in this project, simply because you kind of
need to make all the stages before you can code them.
But we will get into some scripting in a bit later on.
Okay, cool.
That then is our first stage completed.
So we want that kind of form for the majority of things.
Okay.
So for majority sorry.
For the majority of stages we're going to have this kind of form.
So there's a start and end part.
There's the stage part.
You've got a base plate at the end and then everything else okay.
So let's continue on from there to the second stage okay.
Now I've just realized we probably want, um, these two objects here to be in the stage two folder.
Um, the reason why is because as soon as I've gone past this end part, then they're no longer on stage
one, so it wouldn't make sense to have that in the stage one folder.
Um, because yeah, here, for example, if they respawn here, they'll be at stage two, not at stage
one.
Okay.
So we have to do it that way instead.
Okay.
Um, so for this stage I would like to make a bit more difficult as that was like a maybe an introduction
stage, I guess, but it wasn't too difficult at all.
In this next stage, we're going to include lava parts.
Okay.
Now, what these are is they will be a parts where if a player touches them, they die.
Okay?
And it's up to you whether you want them to die instantly or for its takeaway, maybe 3040 health.
So I've got 1 or 2 lives going through this.
Okay.
Um, so to do this, we first need to set up the spawn bit.
So we've got on stage two here, the spawn location, the base plates.
Um, I'm also going to copy over the start part, paste into here and move it over into the correct
position, which is just about here.
Yeah.
And also move over the stage.
Part two.
Stage two.
Move that over.
To here.
Is that lined up correctly?
Yes it is.
And obviously rename this stage to okay.
So text label.
Text stage to.
Cool.
So this one's going to be a flat platform with some lava parts on it.
So I'm going to copy the base plate over.
I know this jump here is possible.
So I'm going to do a similar kind of jump on the other side.
I think that's roughly the same.
Maybe a little bit more.
Okay cool.
I'm going to give it a relatively basic background.
Um, maybe more of a stone background might look good.
Um, or rock.
Maybe like that and I'm going to make this much larger length wise.
Um.
See.
Maybe 70.
Looks quite good there.
Okay.
And through here we're just going to add some parts in that add the lava parts in.
Okay.
So this will be I guess the platform.
Then we can just copy this and call this lava parts.
Like that's fair.
Let's move it up.
Oh, got to move on.
Dad's there.
Just buy one.
Cool.
And, um, change the material.
Obviously, it doesn't look like lava at all.
So we can change this to be like a red and change the material to obviously be cracked lava.
There we go.
Looks quite nice.
Okay.
And you can just position these throughout here.
Okay.
So that's what I'm going to have I'm just going to have a go at doing first.
I'm not going to do too many of these because otherwise it would take a long time.
But I'll do enough so that it's difficult for the player.
Of course.
Um, it's gonna have to jump over the ones here.
Um, then maybe when I get to.
Here they are.
It's a way for them to get their.
Go through that bit there.
Here.
Go through that little bits.
Maybe I can increase this a little bit.
Down to here.
Duplicates.
All about duplicating and positioning these parts in different areas.
You don't want to be adding in new parts every single time and it'll take you too long.
Okay.
And, um, use this one.
Ask me difficult bit for them there and then um, maybe here we can say, well, you can either go this
bit.
Or.
You can go.
Here.
And about take you straight to the end of our.
Okay, obviously I'm going through it a bit quicker, but I'd encourage you to maybe go through and
add some more in, but I think it looks quite good.
I think maybe just adding in another one here a bit too much space, I think.
But obviously you can design this however you'd like to.
Okay.
Cool.
Okay, now on to the coding.
So we now need to code these lava parts.
Now let's now let's think about this.
Um, we know or hopefully, you know, we're going to be using the touched event.
Okay.
So when a part is touched make sure that it's a, it's a player which touched it and then take away
their health.
Okay.
Nothing too difficult.
However we've got a lot of these parts here.
Now you might think, well, we can just copy this script into all of our parts, but when especially
when you've got a lot of these lava parts, it can be quite time consuming to copy and paste these scripts.
And especially if you realize actually you've made an error in one of those scripts, you've then got
to delete all of them, copy paste them in.
Again, it just makes it more difficult to work with.
So instead, using tables which you looked at towards the end of the scripting section, we're going
to create all of these in a folder.
And basically when you use a use the Get Children function server, it will work for all of the all
of the children in this folder here we're going to call this folder here Lava Parts okay.
And add a script inside of there.
Okay.
So the reason why we're doing this again it makes it easier to work with.
You've only got one script controlling all of these lava parts instead of one controlling each one.
Okay I'm going to call this cool parts.
Okay.
So let's first let's reference the folder.
So local lava parts is equal to script parent like that there.
Okay.
And we then want to do our for loop.
We looked at this we looked at this as one of the latest topics in this section.
Okay.
So for I comma v now we could call it v I'm going to call it for I comma part.
Makes a bit more sense in the context.
Again you can change it based on what you want.
For I come apart in pairs.
Um lava parts colon get children there.
So that will create that will create a table full of all of the children in the lava parts folder.
Okay.
Which is perfect.
I'm not sure if I mentioned it when I taught you it, but you can replace I and V to be whatever you'd
like.
Okay, I'm changing it to be part.
It makes a bit more sense when you put it into context.
Um, now we can't just jump straight ahead and write out the event.
The reason why is because if you look in the lava parts folder, all of these here are children of that
folder, one of them being the script.
Okay, the script does not have a touch event, so if you try to reference it, it will not work.
So we need to make sure that anything inside of this folder is a part.
And the way we can do that is just by saying, um, if part and we use a handy built in, we use a handy
function that's already been made for us called is like this here.
And this checks if it's of a certain class.
Now a class you can find in the class name property here.
All of these have class names here called parts you can see there.
But this one has a class name called script.
And we can use that to determine which is which.
So if the class name with speech marks is a part, then we can run our code.
Otherwise don't do anything else.
So it works for all of the parts, but nothing else.
Okay, now we just do our touched event.
Okay, we'll be using these a lot in the Obi so you'll get used to them.
So part dot touched colon connect function hit being the part that we collided with.
Cool.
We want to make sure that whatever wherever the part collided with was a humanoid.
As they're touching other parts and stuff as well.
Okay.
So we're going to create a variable for the humanoid which will be equal to hit dot parent.
So the object which collided with our lava part and its parent.
And remember we say colon find first child humanoid.
Okay.
If you ever need a refresher on any of the concepts and going over here, maybe go back to the lesson
where we covered it.
Okay, um, the point of these lessons isn't not isn't so much to revisit these things, but to apply
them.
So if you are struggling a little bit and thinking, hold on, you're going through it a bit too fast,
don't quite remember touched, I'd recommend just going back to a lesson we did on it.
Okay, and the reason why I created a variable for it is because we need to check that the humanoid
exists, and we also need to use it to take away the health.
So that's why I created a variable for it there.
Okay.
So if humanoid okay.
Because we would replace that with all this here.
But it's easier just to say if humanoid it makes a bit more sense when we're reading.
Out, then we want to take away the health.
Okay, so take away.
Health.
And.
Right.
Not just in notes.
There.
Okay.
You don't have to write the two dashes afterwards.
I like to vote.
I think it looks a bit nicer personally.
Again, it's just one of the preference things.
It's completely fine if you don't want to.
So I believe I've shown you before how to take away health from the play.
But if not, or if you don't remember, it probably was a very small bit that I looked at in the workspace.
My character or your character there.
Um, go to the character humanoid and there's a handy property somewhere here called health.
There we go.
Change this to 90, for example, and player takes damage.
Change this to zero and my player completely dies.
Okay.
So we can use that just to change here.
Now there's two options that you might want to do.
You might want this instantly killed a player.
Or you might want it to only take away a certain amount of damage.
So I'll show you both ways.
If you want it to instantly kill the player, you would just say humanoid dot health is equal to zero.
Okay, now autocorrect, the feature autocorrect might not work here because the humanoid doesn't exist
yet.
It doesn't find it yet.
It's not something that it can reference and see, so it might not like it too much.
But if you don't, auto autocorrect here isn't coming up.
It is okay, so that's how you take away very simple to kill the player.
Okay.
If you want to just take away a certain amount of health from the player, you could say humanoid dot
health is equal to the current health value minus whatever increment you like.
Okay, players are 100 damage if you want them to have one life, you'd want to say 50 and so on.
Okay, so you could set it to be 20 1050.
Up to you.
What you want to do there.
Okay, I'm going to have it as instantly killing the player.
But again you can change that to whatever you'd like it to be.
Okay.
And there we go.
Okay.
That's all of the code involved there.
So a bit of application of the events with four icon moves.
And hopefully it's good good understanding as well about how useful they are because otherwise have
to duplicate this script for each of the lava parts, which is very difficult to work with.
Okay, so let's play the game.
Now we know this works all fine already, so we can just play from here and let's see if we if it's
one possible and two if it works.
So let's jump over here.
Cool.
Let's jump over okay.
Over here.
Yeah.
Ooh, bit difficult here.
Let's jump over that.
Oh, we died here.
Good, because it works.
But I did die.
So let's try again.
Oh.
Oh, I'm dying at that bit again.
Can we keep dying?
It might be.
It might mean.
Oh, yeah.
Okay, that's completely fine.
We spawned back here because basically we haven't done any code yet.
We're just telling the game where to spawn us.
Okay, so we could spawn here.
We could spawn here.
Basically, it's random at the moment which spawn location we spawn in, which is fine.
Okay, that will be something that we will change.
Um, later on I'm going to move this a bit.
A bit too difficult.
I think I might have made it a bit too difficult for people.
Cool.
And then let's just maybe.
There we go.
Let's try again.
Then we know it works, which is amazing.
But let's try and make sure it's possible as well before we get the players to do this.
Jump.
You go easily.
Jump over that.
Now jump over there and we're done.
Perfect.
So all we need to do then is create the spawn for the next stage, which we'll do in the next lesson.
Okay.
So um, hopefully you've had a go at this as well.
Um, I wouldn't recommend, um, copying exactly what I've done like part by part.
Okay.
That would take a bit of a while, but just put your own put your own inspiration and stuff onto it.
But this is just a good way of you just understanding some of the different aspects.
Okay.
So hopefully you enjoyed that.
And next lesson we're going to have a look at the next stages.
Most of them will involve a bit more coding as well.
Okay so hope you enjoyed this and join me in the next lesson where we're going to continue working on
this course.